package com.hand.demo.infra.util;

import org.hzero.boot.file.FileClient;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author yufan.yao@hand-china.com 2023/9/24 20:33
 */
public class FileUpload {
    @Autowired
    FileClient fileClient;
    /**
     * 获取文件url
     * @param organization 租户id
     * @param bucketName   桶名,在“文件上传配置”中配置的“分组”
     * @param storageCode  存储配置编码,在“文件存储配置”中配置的“存储编码”
     * @param url          文件的url
     * @param expire       授权时长(单位秒)
     * @return
     */
    public String getUrl(long organization,String bucketName,
                         String storageCode,String url,long expire
                         ){

        String signedUrl = fileClient.getSignedUrl(organization, bucketName, storageCode, url, expire);
        System.out.println(signedUrl);
        return signedUrl;
    }
}
